package _interview75;

import java.util.ArrayDeque;
import java.util.Queue;

/**
 * 933. 最近的请求次数
 */
public class No933 {
    private final Queue<Integer> deque;

    public No933() {
        deque = new ArrayDeque<>();
    }

    public int ping(int t) {
        while (!deque.isEmpty() && deque.peek() < t - 3000) {
            deque.poll();
        }
        deque.add(t);
        return deque.size();
    }
}
